package com.tancire.works.service.impl;

import java.util.List;
import javax.annotation.Resource;

import cn.hutool.core.util.IdUtil;
import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.works.mapper.SideWorkMapper;
import com.tancire.works.domain.SideWork;
import com.tancire.works.service.ISideWorkService;

/**
 * 兼职管理Service业务层处理
 *
 * @author tancire
 * @date 2024-02-27
 */
@Service
public class SideWorkServiceImpl implements ISideWorkService {
    @Resource
    private SideWorkMapper sideWorkMapper;

    /**
     * 查询兼职管理
     *
     * @param id 兼职管理主键
     * @return 兼职管理
     */
    @Override
    public SideWork selectSideWorkById(Long id) {
        return sideWorkMapper.selectSideWorkById(id);
    }

    /**
     * 查询兼职管理列表
     *
     * @param sideWork 兼职管理
     * @return 兼职管理
     */
    @Override
    public List<SideWork> selectSideWorkList(SideWork sideWork) {
        return sideWorkMapper.selectSideWorkList(sideWork);
    }

    /**
     * 新增兼职管理
     *
     * @param sideWork 兼职管理
     * @return 结果
     */
    @Override
    public int insertSideWork(SideWork sideWork) {
        sideWork.setCreateTime(DateUtils.getNowDate());
        sideWork.setId(IdUtil.getSnowflakeNextId());
        return sideWorkMapper.insertSideWork(sideWork);
    }

    /**
     * 修改兼职管理
     *
     * @param sideWork 兼职管理
     * @return 结果
     */
    @Override
    public int updateSideWork(SideWork sideWork) {
        sideWork.setUpdateTime(DateUtils.getNowDate());
        return sideWorkMapper.updateSideWork(sideWork);
    }

    /**
     * 批量删除兼职管理
     *
     * @param ids 需要删除的兼职管理主键
     * @return 结果
     */
    @Override
    public int deleteSideWorkByIds(Long[] ids) {
        return sideWorkMapper.deleteSideWorkByIds(ids);
    }

    /**
     * 删除兼职管理信息
     *
     * @param id 兼职管理主键
     * @return 结果
     */
    @Override
    public int deleteSideWorkById(Long id) {
        return sideWorkMapper.deleteSideWorkById(id);
    }
}
